1. Field of the Invention
The present invention relates to a context switch method, and more particularly, to a context switch method capable of promptly switching a context for a dynamically generated task and a dynamic link by converting a state of multiple register files, switching the context, and separately restoring and storing the context, and a system using the method.
2. Description of the Related Art
Recently, with development of computing technology, use of a real-time operating system (RTOS) in an embedded system has become widely spread. In the RTOS, a multi tasking function is essential, so that a function for a context switch of multiple registers are required in a processor, such as a microcontroller, a digital signal processor (DSP) and the like. Accordingly, a prompt context switch is an essential key for an effectiveness of the RTOS. Since most time required for the context switch is spent storing or restoring the multiple registers, a prompt context switch method reducing time required for storing or restoring the multiple registers is required.
Also, according to a conventional art, a number of registers used by a task is analyzed and determined before use, and a register file is divided by the number of registers. Namely, in the conventional art, the register file is organized by each of the tasks.
FIG. 1 is a diagram illustrating an example of dividing a register file by each task in the conventional art. Referring to FIG. 1, in a context switch system in the conventional art, the register file is divided into a register 101 for task A, a register 102 for task B and register 103 for task C.
According to the conventional art, a greater storage capacity for the register file is required since the register file is divided by each task.
Also, a required register is unaware of when an operating system (OS) function is used since an entire context used by the task is statically determined, and a static register is not able to be used and analyzed when a new code is used by a dynamic library or when a function pointer is used. Also, the entire context is allocated to a temporary/temporarily used register.
Accordingly, in order to solve the problems of the conventional art, a prompt context switch system capable of being applicable to a dynamically generated task and a dynamic link is required.